package cn.chenxiejia;

import java.util.Calendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/***
 * @program: maven
 * @ClassName: Reg1
 * @Description:
 * @Author: chenxiejia
 * @Date: 2022/1/14 13:19
 * @version : V1.0
 */
public class Reg1 {
    public static void main(String[] args) {
        System.out.println("ssfdsfsda".matches("[a-z]+"));
        System.out.println("速度放缓e".matches("[\u4e00-\u9fa5]+"));
        System.out.println("速度放缓e".matches("[\u4e00-\u9fa5]*"));
        System.out.println("速".matches("[\u4e00-\u9fa5]?"));
        System.out.println("速e".matches("[\u4e00-\u9fa5].?"));
        System.out.println("jvjdghfdjskfgjavasdfjvjjava".matches("^.*java.*$"));
        //Pattern pattern = Pattern.compile("^1[358]\\d{9}$");
        Pattern pattern = Pattern.compile("^1[358]\\d{9}$");
        var a = pattern.matcher("18338614928");
        a.find();
        System.out.println(a.group());
        Calendar cl = Calendar.getInstance();
        var time = cl.getTime();
        System.out.println("20220115".matches("^2.2.\\d{8}$"));
        System.out.println("*".repeat(20));
        String ac = "java8php123javascript6mysql88888html5";
        System.out.println(ac);
        System.out.println(ac.replaceAll("\\d+?", "-"));//?禁用贪婪

        String str = """
                <div>hello</div><div>java 15</div><div><p>java 15</p><span>java 8</p><div>java 15</div></div>
                """;

        Pattern p = Pattern.compile("<div>.*?java.*?</div>");
        Matcher m = p.matcher(str);
        System.out.println("*".repeat(20));
        while (m.find()) {
            System.out.println(m.group());
        }

    }
}
